import { Injectable } from '@nestjs/common'
import { CreateProjDto } from './dto/create-proj.dto'
import { UpdateProjDto } from './dto/update-proj.dto'
import { PrismaService } from 'src/prisma/prisma.service'

@Injectable()
export class ProjService {
  constructor(private prisma: PrismaService) {}
  create(createProjDto: CreateProjDto) {
    return 'This action adds a new proj'
  }

  async findAll(args: Record<string, any>) {
    const { userId } = args
    return await this.prisma.proj.findMany({
      where: { userId: +userId },
      include: {
        section: true,
      },
    })
  }

  findOne(id: number) {
    return `This action returns a #${id} proj`
  }

  update(id: number, updateProjDto: UpdateProjDto) {
    return `This action updates a #${id} proj`
  }

  remove(id: number) {
    return `This action removes a #${id} proj`
  }
}
